package cn.stylefeng.guns;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.nio.charset.Charset;
import java.util.List;

/**
 * @Description 无限小说网
 * @Author xiesm
 * @Date 2023/11/2 15:58
 **/
@Slf4j
public class Test37 {
    public static final String host = "https://https.558849.vip/Zs/index.html";

    public static void main(String[] args) {
        get();
    }

    public static void get() {
        String s = FileUtil.readString("D:\\乱七八糟\\hhh.txt", Charset.defaultCharset());
        Document document = Jsoup.parse(s);
        Elements kits = document.getElementsByClass("kj-tit");
        for (int i = 0; i < kits.size(); i++) {
            Element element = kits.get(i);
            Elements dts = element.nextElementSibling().select("dt");
            List<String> list = Lists.newArrayList();
            list.add(element.text());
            for (int j = 0; j < dts.size(); j++) {
                Element dt = dts.get(j);
                list.add(dt.text());
            }
            System.out.println(list);
        }
    }


    public static String http(String path) {
        String body = HttpUtil.get(host + path);
        return body;
    }
}